<template>
	<om-formsub-outer :index="index" :checkedit="checkedit">
		<om-autoform ref="autoform" :initConfigData="autoformdata" :initValue="initValue"></om-autoform>
	</om-formsub-outer>
</template>

<script>
	import {buildSubFormData, subOnLoad, changeEditor,configSelectData,hasValue} from '@/static/js/formUtil.js';
	import { ignoreHtml,ptFloat,minusF,getDateStr} from '@/static/js/common.js';
	export default {
		provide() {
			return {
				formPage: this
			};
		},
		data() {
			return buildSubFormData({
				userCacheKey:"fin-xz-salaryDeduction-title2-userId-cache"
			})
		},
		methods:{
			
		},
		onShow() {
			let _that = this
			if(_that.$refs.autoform){
				uni.getStorage({
					key:_that.userCacheKey,
					success:(res)=>{
						if(res.data){
							let d = res.data
							let formdata = _that.$refs.autoform.formdata
							formdata.userName = d.userName
							formdata.userId = d.userId
							formdata.salaryPosId = d.salaryPosId
							formdata.parentInstId = d.parentInstId
							formdata.salaryPosName = d.salaryPosName
							formdata.instId = d.instId
							formdata.instName = d.instName
							formdata.parentInstName = d.parentInstName
							formdata.yearMonth = d.yearMonth
							formdata.salaryDeductionDataShowId = d.salaryDeductionDataShowId
							formdata.yearMonthDate = d.yearMonthDate
							formdata.remark = d.remark
							uni.removeStorage({
								key:_that.userCacheKey
							})
						}
					}
				})
			}
		},
		onLoad(e) {
			let _that = this
			subOnLoad(_that, e, function() {
			if(e.configDataCacheKey){
				uni.getStorage({
					key: e.configDataCacheKey,
					success: function(res) {
						if(res.data && Object.prototype.toString.call(res.data)==='[object Array]'){
							_that.autoformdata = res.data
							Object.assign(_that.initValue, _that.formdata)
							_that.autoformdata[0].order = _that.order
								changeEditor("title2","userId",{
									link:'../../public/pageSearch/pageSearch',
									"linkParam":{
										other:JSON.stringify({
											postId: e.posId,
											oldValue: ''
										}),
										url:"cancelSalaryDeduction/getSalaryDeductionDataShowPage",
										namefield:"userName",
										initload:true,
										cachename:_that.userCacheKey
									}
								},null,_that.autoformdata)
							}
						}
					})
				}
			})
		}
	}
</script>

<style>
</style>                                                                                                                                                                                                                                                                                                                                                                                                                                                         
